package pers.fulsun.blog.controller;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import net.dreamlu.mica.common.support.IController;
import net.dreamlu.mica.core.result.R;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import pers.fulsun.blog.entity.User;
import pers.fulsun.blog.service.UserService;

/**
 * 服务控制器
 *
 * @author fl
 * @since 2021-11-29 11:19:42
 * @description 由 Mybatisplus Code Generator 创建
 */
@Slf4j
@RequiredArgsConstructor
@RestController
public class UserController implements IController {
  private final UserService userService;

  @PostMapping("/login")
  public R<User> login(String username, String password) {
    User user = userService.findByUsername(username,password);
    return success(user);
  }
}
